home *** CD-ROM | disk | FTP | other *** search
-
- PERSONAL PASCAL
- (OSS $79.95)
- Reviewed by Ed Seward
-
-
- Let me start with the disk and it's contents. Among the files on the disk
- are the required four program files: PASCAL.PRG, EDIT.PRG, COMPILER.PRG and
- LINKER.PRG. (More on these files in a little bit.) Also on the disk is a
- collection of demo programs, a list of errors found in so far and several
- "Include" files for accessing GEM.
-
- The execution of PASCAL.PRG (the "Manager") places you in the Pascal
- environment. From this point you can choose the compiler and linker options
- and save them as the new defaults. There are three things I don't like at
- this level. The first is that when exiting the Pascal manager after
- compiling; it takes a few tries with the mouse to get window slide bars to
- work properly. Another is the editor and compiler can only use filenames
- with the extension of "PAS". This means one has to change the name of the
- file from the GEM Desktop. (One can display the whole directory from the
- Pascal manager, its just when a file with an extension other than "PAS" is
- used that kicks one back to the manager). The last thing is that on a one
- drive system all the required files must be on the same disk. This problem
- could be taken care of in a one meg machine with a ramdisk.
-
- The Pascal Editor. Upon entering the editor one will notice a status line at
- the top of the screen. On the left end of the line is the name of the file
- being edited including the drive and path. The right side of the line is for
- the various indicators like: whether one is in "insert" or "replace" mode; if
- the auto backup is enabled; auto indent on/off. There is also a counter for
- the amount of memory available for the source code and the line number of the
- cursor's position.
-
- The writers of Personal Pascal have set up the editor so as to make as many
- people happy as possible. For most commands, one has a choice of using
- "Wordstar" commands or using the cursor control keys. The availabilty of the
- "Wordstar" commands should make many people happy. Personnaly, I prefer to
- use the cursor keys. To move one character in any of the four basic
- directions, just use the appropriate arrow key. To move up or down one
- screen push a [Shift] key and an arrow key at the same time. The [Shift]
- left and right arrow keys allow one to go to the beginning or end of a line.
- When using the [Control] key with the left and right arrow keys, the cursor
- is moved to the beginning of the next word in the appropriate direction.
-
- Besides the additional keyboard editor commands there are the commands using
- the function keys. To delete a line and place in the copy buffer just press
- the [F1] key. Pressing the [Shift] and [F1] just deletes the line. To
- insert the copy buffer at the cursor's position press [F2]. The "Find" a
- string command is [F3]. The search and replace string is [F4]. The [F5] key
- causes the last find or search command to be repeated. The auto indent is
- toggled on/off with [F6]. The [Shift] and [F6] toggles the "BAK" or auto
- backup state. Using [F7] allows one to save either the copy buffer or the
- complete text. One can read a file into the copy buffer using [F8]. The
- [F9] key saves the text back to the filename from which it was loaded. (If
- the backup is on then the original file's extension is changed to "BAK"
- before writing the text to disk.)
-
- After writing the file and exiting the editor, the compiler is loaded and
- executed. (If there are no compiler errors and the option is set, the
- compiler will chain to the linker. Thus, with the push of a single key one
- can have an executable program.)
-
- The Compiler. There are eight options available from the Pascal Manager.
- One is the choice to compile for GEM or TOS. The "Pause after error" option
- tells the compiler to pause or not after an error. If one does not pause
- after errors then all errors are written to a text file. If one selects to
- pause after error then when an error is found two windows will appear; one
- with the line of source code where the error was found, an error number and a
- text description of that error (if ERRORS.TXT is on the disk) and another
- window asking "Ignore Edit Abort". Ignore continues the compile; abort
- returns one to the Pascal manager. Edit exits the compiler, loads the editor
- and the source file, puts the cursor at the position where the error was
- found and displays the error message in the status line. The "Chain to
- linker" compiler option was mentioned earlier. The "Temporary directory"
- option allows one to specify a different directory/drive for the temporary
- work files. This option will be more useful after installing the TOS ROMs,
- upgrading to one meg or when using a hard disk.
-
- There are three other options that are mainly for debugging. "Full debug
- mode" includes code such that the line number and the name of the procedure
- where an error occurred will be displayed. "Stack checking" and "Range
- checking" are self explanatory. If one tends to be a little lax in error
- trapping then the last two options may save some potential system hangs. The
- last option is to include code to clear all the local variables. I prefer to
- handle that myself.
-
- I ran into one problem with the compiler. I made an error in an include
- directive that resulted in about twenty-five errors. Not using the "Pause
- after error", as near as I can tell, the compiler ran out of room on the
- disk. (The system was not hung in the true sense as it knew when a disk was
- inserted into the drive and would run the motor.) There was no error message
- -- just nothing at all. True, I could have made sure there was more than a
- few k-bytes of space left on the disk. There should have been some kind of
- message and a way to get out of it without rebooting the system.
-
- While the compiler is running it displays the error count, each include
- file's name as they are included and a cancel button to abort the compile.
- The only thing I'll mention about the linker is that one has the option to
- link for TOS or GEM.
-
- Personal Pascal. So far I haven't found any of the ususal Pascal features
- missing. Several ones have been added. String and byte were to be expected
- and are supported. Also included is Long_Integer. The limit for integer
- types (Maxint) is 32767 and Long_Maxint is 2,147,483,647 for long_integer
- types. Two functions "Shl" and "Shr" have been added to work with integer
- types as shift-left and shift-right. The usual string handling routines are
- included; Concat, Copy, Length, Delete, Insert. Random disk access is also
- supported with a Seek procedure. There are also a couple routines to access
- the TOS command line; Cmd_Args returns the number of arguments in the command
- line, Cmd_GetArg gets a command from the command line. The list of
- predefined portions of Personal Pascal below are from the manual.
-
-
- =======================================================
- Predefined Data Types
- Alfa Byte Boolean Char
- Integer Long_Integer Real String
- Text
-
- Predefined Constants
- False Input Long_Maxint Maxint
- Nil Output True
-
- Predefined Procedures
- BasePage Chain Cmd_GetArg Delete
- Dispose Erase Get Halt
- Insert Mark Message New
- Pack Page Put Read
- Readln Release ReName ReSet
- ReWrite UnPack Write Writeln
-
- Predefined Functions
- Abs ArcTan Chr Clock
- Close Cmd_Args Concat Copy
- Cos Eof Eoln Exp
- Filename Handle KeyPress Length
- Ln Long_Round Long_Trunc MemAvail
- Odd Option Ord Pos
- Pred PwrOfTen Round Shl
- Shr Sin SizeOf Sqr
- Sqrt Succ Trunc
- =======================================================
-
- There are 90 pages of documentation for the non-GEM portion of Pascal.
-
- Personal Pascal & GEM. There are 98 routines for accessing GEM and 134 pages
- of documentation for those routines. There is routine for doing alert boxes
- and it is plenty. Most of the other routines can be grouped into four
- catagories: dialog boxes, windows, the menu bar and event management.
-
- Two dialog boxes are very easy to implement. One is to select an input file
- and another is to select an output file. Then there are numerous routines
- used to set up a box including setting the type and color of text, buttons
- and valid characters for an editable text field. There are step-by-step
- instructions for setting up a dialog box along with good explanations of the
- routines.
-
- I haven't used the windows much -- yet. I haven't used the rest of the
- routines at all. There are twenty-two window routines just for text styles
- and graphics. These include rectangle, oval and arc drawing, cursor move,
- plot and line drawing. The menu bar routines provide all that is needed for
- one to do there own drop down menus.
-
- Documentation. With one group of exceptions I would say the documentation
- included with Personal Pascal is excellent and all one should expect. The
- group of exceptions are three directives: GEMDOS, BIOS and XBIOS. They are
- mentioned as existing and taking one integer parameter each. (My
- understanding is that the number of parameters should vary.) As I write this
- in early February, OSS has said they will be making the documentation
- available in a few days.
-
- The rest of the manual I found to be very complete and easy to find the
- information I needed. This manual is not meant to teach Pascal and as such
- it does not waste any space on a tutorial.
-
- Features (bugs). I have come across two bugs besides the two I mentioned
- earlier. First, 'Read' and 'Write' only work on text files. I played with
- this for a while before using 'Get' and 'Put' as shown in the manual. The
- other problem is that the manual says 'Insert' can have a "packed array of
- char" as the source to be inserted into a string. I used other means to do
- it one character at a time.
-
- I called OSS today to verify these bugs. The guy I talked to said they are
- getting ready to release a small patch to take care of the problem with the
- slidebar when exiting Pascal. The 'Insert' problem is probably a
- documentation error. OSS should be coming out with the next version of
- Pascal in April. There may be a patch to take care of the 'Read' and 'Write'
- problem before then, if not, then that release should take care of the
- problem.
-
- Performance. Like any person with a new language for their computer, I was
- anxious to run some benchmarks. In the table on the next page are six
- different time tests. Two of the programs I converted from a review of
- MODULA Compilers in the October 1985 issue of Computer Languages magazine
- ("Microcomputer Modula-2 Analysis" by Namir Clement Shammas and Ken Magel).
- [Modula-2 is basically an enhanced version of Pascal.] Two others are fairly
- standard but taken from a Turbo Pascal 3.0 review in the February 1986 issue
- of Byte magazine ("Turbo Pascal 3.0" by Mark Bridger). The magazines gave
- times for these tests on the IBM PC (with and without an 8087) and one test
- of MacModula-2 on the Macintosh. I ran the same tests on the 520 ST using
- OSS Personal Pascal and also, for comparison, using TDI's Modula-2.
-
- As you can see the times are pretty good. The times for the Modula-2 package
- on the ST are particularly good but note that the file sizes are much larger
- than those developed using Personal Pascal. I found the system easy to adapt
- to and friendly to use. There are quite a few error messages to make finding
- the syntax errors a little easier. I also liked the full debug mode as a
- compiler option. Even with the bugs I mentioned I think Personal Pascal is a
- good way to take advantage of the ST's features.
-
-
-
- ==========================================================================
- ------------R U N T I M E S----------------
- OSS TDI Turbo PASCAL Modula-2 MacMod -----FILE SIZES------
- Test PASCAL MODULA ----V.3.0--- .COM Mcode ula-2 OSS PASCAL TDI Mod-2
- Program 520ST 520ST IBMPC w/8087 IBMPC IBMPC Mac Src Exec Src Exec
- ------- ----- ----- ----- ------ ----- ----- ----- ---- ----- ---- -----
- SIEVE 7.5 6 13 -- 8 123 80 794 4559 732 21682
- CALC 7.2 3 32 6.5 -- -- -- 333 6593 430 21648
- FLOAT 20.5 20 65 3.0 -- -- -- 339 8447 403 25372
- SORT <1.0 <1 -- -- 2 15 30 1332 4892 1224 21964
- MATRIX 3.5 2.5 -- -- 1 20 13 1364 11461 1598 22574
- ===========================================================================
-
- I am including the source code for the above benchmarks to make it easier for
- standard tests on the new languages becoming available for the ST.
-
-
-
- Try these out on other computers or other languages on the ST and send the
- results into CURRENT NOTES (122 N. Johnson Rd., Sterling, VA 22170).
-
-
-
- PROGRAM sieve(OUTPUT);
- CONST size = 8190;
- VAR count,i,iter,prime : INTEGER;
- flags : ARRAY [0..size] OF BOOLEAN;
- BEGIN
- Writeln('START');
- FOR iter := 1 TO 10 DO
- BEGIN
- count := 0;
- FOR i := 0 TO size
- DO flags[i] := TRUE;
- FOR i := 0 TO size DO
- IF flags[i] THEN
- BEGIN
- prime := i + i + 3;
- k := i + prime;
- WHILE k <= size DO
- BEGIN
- flags[k] := FALSE;
- k := k + prime;
- END;
- count := count + 1;
- END; { if then}
- {end for i}
- END; { for iter}
- Write(count);
- Writeln(' primes found');
- END {program sieve}.
-
-
- PROGRAM calc (OUTPUT);
- {from February 1986 Byte magazine}
- VAR a,b,c : REAL;
- n,i,t : INTEGER;
- BEGIN
- Writeln('START');
- FOR t := 1 TO 10 DO
- BEGIN
- n := 5000;
- a := 2.21828;
- b := 3.14159;
- c := 1;
- FOR i := 1 TO n DO
- BEGIN
- c := c * a;
- c := c * b;
- c := c / a;
- c := c / b;
- END;
- END;
- Writeln;
- Writeln('Error = ',c-1);
- END {program calc}.
-
-
- PROGRAM float (OUTPUT);
- {from February 1986 Byte mag.}
- {I didn't add in other real functions}
- {so as to keep 'float' standard. }
- VAR i : INTEGER;
- x,y : REAL;
- BEGIN
- x := 1;
- FOR i := 1 TO 1000 DO
- BEGIN
- y := Sin(x);
- y := Ln(x);
- y := Exp(x);
- y := Sqrt(x);
- y := Arctan(x);
- x := x + 0.01;
- END;
- END {program float}.
-
-
- PROGRAM CLMySort (OUTPUT);
- {converted from Computer Language mag}
- {MODULA listing in October 1985 issue}
- {Program will test the speed of sor- }
- {ting an integer array. The program }
- {will create an array sorted from }
- {smaller to larger integers then sort}
-
- {them into reverse order. }
- CONST max = 1000;
- TYPE numbers = ARRAY [1..max] OF INTEGER;
- VAR done : BOOLEAN;
- jump,i,j,temp : INTEGER;
- a : numbers;
- BEGIN
- Writeln('Initializing integer array');
- FOR i := 1 TO max
- DO a[i] := i;
- jump := max;
- Writeln('Beginning to work');
- WHILE jump > 1 DO
- BEGIN
- jump := jump DIV 2;
- REPEAT
- done := TRUE;
- FOR j := 1 TO (max - jump) DO
- BEGIN
- i := j + jump;
- IF a[i] > a[j] THEN
- BEGIN
- done := FALSE;
- temp := a[i];
- a[i] := a[j];
- a[j] := temp;
- END { if then};
- END { for do };
- UNTIL done;
- END {while};
- Writeln('Finished sorting!');
- FOR i := 1 TO max
- DO Write(a[i],' ');
- Writeln;
- END {program CLMySort}.
-
-
- PROGRAM CLMatix(OUTPUT);
- CONST n = 20;
- TYPE row = ARRAY [1..n] OF REAL;
- table = ARRAY[1..n] OF row;
- VAR a,b,c : table;
- sum : REAL;
- i,j,k : INTEGER;
- ch : CHAR;
-
- PROCEDURE FillA;
- VAR i,j : INTEGER;
- BEGIN
- FOR i := 1 TO n DO
- FOR j := 1 TO n DO
- a[i,j] := i + j + 2;
- END {procedure filla};
-
-
- PROCEDURE FillB;
- VAR i,j : INTEGER;
- BEGIN
- FOR i := 1 TO n DO
- FOR j := 1 TO n DO
- b[i,j] := (i + j + 2) DIV (j + 1);
- END {procedure fillb};PROCEDURE FillC;VAR i,j : INTEGER;
- BEGIN
- FOR i := 1 TO n DO
- FOR j := 1 TO n DO
- c[i,j] := 0.0;
- END {procedure fillc};
-
- BEGIN
- sum := 0.0;
- Write('Press <CR> to start');
- Read(ch);
- Writeln;
- FillA; Writeln('A filled');
- FillB; Writeln('B filled');
- FillC; Writeln('C filled');
- FOR i := 1 TO n DO
- FOR jk := 1 TO n DO
- FOR k := 1 TO n DO
- c[i,j] := c[i,j] + a[i,k] * B[k,j];
- Writeln('Multiplied');
- FOR i := 1 TO n DO
- FOR j := 1 TO n DO
- sum := sum + c[i,j];
- Writeln('sum = ',sum);
- Writeln('End of program');
- END {CLMatrix}.
-
-
-
- [Reprinted from the March, 1986 issue of CURRENT NOTES: The Newsletter for
- Atari Owners. CURRENT NOTES is published by the Washington Area Atari
- Computer Enthusiasts, 122 N. Johnson Rd., Sterling, VA 22170 ($15/yr). This
- article may be reprinted by any Atari user group newsletter provided CURRENT
- NOTES and the author are cited.]
-
-
-
- Press <CR> to continue: